﻿#ifndef srcQGraphicsView_H
#define srcQGraphicsView_H

#if _MSC_VER == 1600
#pragma execution_character_set("utf-8")
#endif

#include <QGraphicsView>
#include <QMouseEvent>
#include <QMessageBox>
#include <QMenu>
#include <QList>
#include <iostream>
#include <vector>
using namespace std;

class srcQGraphicsView : public QGraphicsView
{
    Q_OBJECT
public:
    explicit srcQGraphicsView(QWidget *parent = 0);

    //标记独立点（0），标记连续点（1），测量距离（2），选取ROI（3），拖拽模式（4）
    //读像素值（5），显示ROI（16），左键移动（17）
    int state;  //用位来存储状态
    QGraphicsRectItem* rect;
    QGraphicsLineItem* line;
    QGraphicsPixmapItem* pixm;
    QPen pen;  // creates a default pen
    vector<QPointF> C_points;
    vector<vector<QPointF> > C_pointsVec;
    QList<QGraphicsLineItem *> C_point,C_line;
    QMenu rightMenu;

public slots:
    void viewMenu(QPointF );
    void addPoint();
    void addPoints();
    void disMod();
    void roiMod();
    void dragMod();
    void readMod();
    void clearPoints();

    void drawRoi();

signals:
//    void rightButtonDown(QPointF);
    void leftButtonDown(QPointF );
    void mousePressMove(QPointF );
    void mouseMove(QPointF );
    void leftButtonUp(QPointF );
    void showRect();

private:
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

	
};

#endif // srcQGraphicsView_H
